package com.syezon.wifikey.pwd.adapter;

import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import com.syezon.wifikey.pwd.CommonPwdFragment;
import com.syezon.wifikey.pwd.MyPwdFragment;

/**
 * Created by Administrator on 2018/9/6.
 */

public class PwdAdapter extends FragmentStatePagerAdapter {

    public PwdAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        if (position == 1) {
            return CommonPwdFragment.newInstance();
        }
        if (position == 0) {
            return MyPwdFragment.newInstance();
        }
        return CommonPwdFragment.newInstance();
    }

    @Override
    public int getCount() {
        return 2;
    }


    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        String title = "";
        if (position == 1) {
            title = "常见密码库";
        }
        if (position == 0) {
            title = "我的密码库";
        }
        return title;
    }
}
